import request from '_utils/request.js'
const fetchCates = (url, params = {}) => {
  return new Promise((resolve, reject) => {
    request.get(url, { params }).then(res => {
      console.log(res)
      if (res.data.code === 0) {
        resolve(res)
      }
      if (res.data.code === 2000) {
        location.href = 'http://localhost:3000/user'
      }
    }).catch(err => {
      console.log(err)
    })
  })
}
export {
  fetchCates
}
